<html>
<script>
function FormUriTemplate(f){
    alert('a b c d e ' + document.forms[f].action );
    var url = document.forms[f].action;
    var data = new Array();
    for( var n in document.forms[f] ){
        if( document.forms[f][n] && document.forms[f][n].value ){
          alert(" n " + n);
          alert(" n " +document.forms[f][n].value );
          data[n] = document.forms[f][n].value; 
        }
    }
    url = UriTemplate(url,data);
    alert('a b c d e ' + url );
}
function UriTemplate(url,data){
    for( var n in data ){
        url = url.replace('{' + n + '}',data[n]);
    }
    alert(" url " + url );
    return url;
}
</script>
<body>
<a href="" OnClick="UriTemplate('http://example.com/users/{name}',{name:'akihito'});">on</a>
<form name="f" action="http://example.com/entry/{title}">
<input type="text" name="title" value="rest">
<input type="button" value="send" OnClick="FormUriTemplate('f')">
</form>


</body>
</html>
